package com.qf.dbUtil.common.exception;

import com.qf.dbUtil.common.result.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 功能说明
 *
 * @author yihuan
 * @data 2020-10-1311:26:30
 */
@ControllerAdvice
public class ExceptionAop {

    @ExceptionHandler(AppException.class)
    @ResponseBody
    public R getAppException(AppException ex){
        return new R(ex.getCode(),ex.getMassage(),null);
    }
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public R getException(Exception ex){
        return new  R("500","系统错误",null);
    }
}
